package gui;

import java.awt.BorderLayout;
import java.awt.Dimension;
import java.awt.event.ActionListener;

import javax.swing.Icon;
import javax.swing.ImageIcon;
import javax.swing.JButton;
import javax.swing.JPanel;

public class GuiUtils {
	
	public final static ImageIcon ADD_ICON = new ImageIcon("./res/add.png");
	public final static ImageIcon ADD_ROW_ICON = new ImageIcon("./res/table_row_insert.png");
	public final static ImageIcon DELETE_ICON = new ImageIcon("./res/delete.png");
	public final static ImageIcon EDIT_ICON = new ImageIcon("./res/page_white_edit.png");
	
	public static JButton iconButton (Icon ico, String tooltip, ActionListener action) {
		JButton button = new JButton(ico);
		button.setContentAreaFilled(false);
		button.setPreferredSize(new Dimension(18,18));
		button.setSize(18, 18);
		button.setBorderPainted(false);
		button.setToolTipText(tooltip);
		if(action!=null)
			button.addActionListener(action);
		return button;
	}
	
	public static JPanel  borderPanel (JPanel parent){
		JPanel panel = new JPanel();
		panel.setLayout(new BorderLayout());
		parent.add(panel);
		return panel;
		
	}

}
